package com.reservation.controller;

import com.reservation.common.Result;
import com.reservation.service.ExhibitionReservationService;
import com.reservation.service.GuideService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/reservation")
public class ReservationController {
    @Autowired
    private ExhibitionReservationService exhibitionReservationService;
    @Autowired
    private GuideService guideService;
    /**
     * 普通客户取消预约
     * @param id
     * @return
     */
    @PutMapping("/{id}/cancel")
    public Result<Void> cancelReservation(@PathVariable Long id) {
        boolean result = exhibitionReservationService.cancelReservation(id);
        return Result.success(null, "取消预约成功");
    }
    /**
     * 解说预约取消
     *
     * @param id 预约ID
     * @return 取消结果
     */
        @PutMapping("/{id}/guideCancel")
    public Result<Void> guideReservation(@PathVariable Long id) {
        boolean result = guideService.guideCancel(id);
        return Result.success(null, "取消预约成功");
    }
}
